#include "view_prompt.h"
#include "view_common.h"
#include "display_ctrl.h"
#include "platform_assert.h"
#include "lfs_file_manager_auto.h"
#include "rtc.h"
#include "datetime.h"
#include "blecom.h"
#include "battery_ctrl.h"
#include "sport_his.h"
#include "display_ctrl.h"
#include "display_interface_240x240.h"
#include "datetime.h"
#include "heart_rate_interface.h"
#include "font/num_font.h"
#include "font_mngr.h"
#include "app_trace.h"
#include "view_prompt_message.h"
#include "view.h"
#include "motor.h"
#include "language_text.h"
#include "m_product_test.h"
#include "view_prompt.inc"
#define LOG(fmt, ...) // app_trace_log(fmt "\r\n", ##__VA_ARGS__)
// ANCS中转的变量
void view_prompt_not_connect_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 3)
        {
            display_show_type_recover();
            return;
        }
    }
    int x = 60;
    int y = 36;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_not_connect_60_36);
    x = 51;
    y = 164;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 5;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_not_connect_51_164);
    }
}
void view_prompt_bind_success_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 3)
        {
            display_show_type_recover();
            return;
        }
    }
    int x = 66;
    int y = 38;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_Prompt_connect_66_38);
    x = 69;
    y = 164;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 5;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_Prompt_connect_69_164);
    }
}
void view_prompt_camera_ready_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 100;
        disp_ctrl.auto_close_delay = 1000;
        if (disp_ctrl.auto_refresh_count > 8)
        {
            display_show(view_prompt_camera_fail, DISP_MODE_NORMAL);
            return;
        }
    }
    int x = 32;
    int y = 73;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_9406_prompt_02);
    int index = FILE_IMG_9406_prompt_03 + disp_ctrl.auto_refresh_count % 9;
    x = 94;
    y = 110;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, index);
}
void view_prompt_camera_fail_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 3)
        {
            display_show_type_recover();
            return;
        }
    }
    int x = 94;
    int y = 22;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_9407_prompt_01_94_22);
    x = 37;
    y = 130;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        disp_show_font_string_utf8_area(38, y, 38 + 166, 207, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_9407_prompt_01_37_130);
    }
}
void view_prompt_music_not_connect_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 3)
        {
            display_show_type_recover();
            return;
        }
    }
    int x = 0;
    int y = 0;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, 0, 0, FILE_IMG_K106_notcon_back);
    x = 69;
    y = 189;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 3;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_K106_notcon_back_69_189);
    }
}
void view_prompt_distance_complete_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
            return;
        }

        disp_ctrl.com_data.i_temp[0] = sport_get_distance();
        if (system_config_get_km_mi() != 0)
        {
            disp_ctrl.com_data.i_temp[0] *= 0.6213712;
        }
    }
    int x = 39;
    int y = 13;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_distance_complete_39_13);
    x = 43;
    y = 189;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 2;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_calories_complete_43_189);
    }
    x = 90;
    y = 111;
    x = disp_draw_user_image_num(x, y, disp_ctrl.com_data.i_temp[0] / 1000, 16, num_N300_dig_14x32_TAB);
    x += 2;
    disp_draw_user_image(x, y, num_N311_point_6x32);
    x += 8;
    disp_draw_user_image_num_with_digits(x, y, disp_ctrl.com_data.i_temp[0] % 1000 / 10, 2, 16, num_N300_dig_14x32_TAB);
}
void view_prompt_calories_complete_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
            return;
        }
        disp_ctrl.com_data.i_temp[0] = sport_get_calorie();
    }
    int x = 39;
    int y = 13;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_calories_complete_39_13);
    x = 43;
    y = 189;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 2;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_calories_complete_43_189);
    }
    x = 120;
    y = 111;
    disp_draw_user_image_num_mid_ignore(x, y, RGB565_COLOR_BLACK, disp_ctrl.com_data.i_temp[0], 16, num_N300_dig_14x32_TAB);
}

void view_prompt_steps_complete_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
            return;
        }
        disp_ctrl.com_data.i_temp[0] = sport_get_present_step();
    }
    int x = 39;
    int y = 13;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_steps_complete_39_13);
    x = 43;
    y = 189;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 2;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_calories_complete_43_189);
    }
    x = 120;
    y = 111;
    disp_draw_user_image_num_mid_ignore(x, y, RGB565_COLOR_BLACK, disp_ctrl.com_data.i_temp[0], 16, num_N300_dig_14x32_TAB);
}
void view_prompt_lost_display(void)
{
    int x = 60;
    int y = 36;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_not_connect_60_36);
    x = 51;
    y = 164;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 5;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_not_connect_51_164);
    }
}
void view_prompt_drink_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
        }
    }
    int x = 60;
    int y = 46;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_drink_60_46);
    x = 67;
    y = 164;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 5;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_drink_67_164);
    }
}
void view_prompt_sedentariness_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
        }
    }

    int x = 75;
    int y = 45;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_sedentary_75_45);
    x = 56;
    y = 168;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 5;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_sedentary_56_168);
    }
}
void view_prompt_low_power_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
        }
    }
    int x = 0;
    int y = 94;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_prompt_bat_low_0_94);
    x = 63;
    y = 164;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 3;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_prompt_bat_low_63_164);
    }
}
void view_prompt_not_wear_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 5)
        {
            display_show_type_recover();
        }
    }
    int x = 25;
    int y = 164;
    if (disp_ctrl.com_data.uint8_temp[100])
    {
        y -= 1;
        disp_show_font_string_utf8_mid(y, (char const *)(&disp_ctrl.com_data.uint8_temp[101]), 0);
    }
    else
    {
        _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_J120_watch_25_164);
    }
    x = 41;
    y = 49;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_1, x, y, FILE_IMG_J120_watch_41_49);
}
void view_prompt_find_wrist_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 250;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 40)
        {
            display_show_type_recover();
            return;
        }
    }
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, 52, 52, FILE_IMG_SJDJ_52_52);
    int x = 0;
    int y = 0;
    switch (disp_ctrl.auto_refresh_count % 4)
    {
    case 0:
        x = 46;
        y = 54;
        break;
    case 1:
        x = 54;
        y = 59;
        break;

    case 2:
        x = 60;
        y = 54;
        break;

    case 3:
        x = 53;
        y = 47;
        break;
    }
    disp_draw_user_image(52 + x, 52 + y, icon_find_wrist);
}
void view_prompt_charing_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        // disp_ctrl.auto_refresh_time = 800;
        product_test_state_t state = product_test_state_get();
        switch (state)
        {
        case PRODUCT_TEST_STATE_TEST_PCBA:
            disp_ctrl.auto_refresh_time = 800;
            disp_ctrl.auto_close_delay = 2000;
            break;
        case PRODUCT_TEST_STATE_TEST_ASSEM:
            disp_ctrl.auto_refresh_time = 800;
            break;
        }
    }
    int x = 39;
    int y = 83;
    img_gif_com_t const img_cfg_2 = {
        .gif_count = 3,
        .img[0].x = x,
        .img[0].y = y,
        .img[0].sn = FILE_IMG_T211_Charging_1_43_71,
        .img[1].x = x,
        .img[1].y = y,
        .img[1].sn = FILE_IMG_T212_Charging_2_43_71,
        .img[2].x = x,
        .img[2].y = y,
        .img[2].sn = FILE_IMG_T213_Charging_3_43_71,
    };
    _disp_show_flash_img_gif_all(&img_cfg_2, DISP_LFS_FILE_INDEX_0);
}
void view_prompt_alarm_display(void)
{
    if (disp_ctrl.loop_cnt == 0)
    {
        disp_ctrl.auto_refresh_time = 1000;
        disp_ctrl.auto_close_delay = disp_ctrl.auto_refresh_time + 1000;
        if (disp_ctrl.auto_refresh_count >= 30)
        {
            display_show_type_recover();
        }
        datetime_t UIdatetime = DateSync();
        disp_ctrl.com_data.i_temp[0] = UIdatetime.time.hour;
        disp_ctrl.com_data.i_temp[1] = UIdatetime.time.minute;
        if (if_time_hour_system_12())
        {
            disp_ctrl.com_data.i_temp[0] %= 12;
            if (disp_ctrl.com_data.i_temp[0] == 0)
            {
                disp_ctrl.com_data.i_temp[0] = 12;
            }
        }
    }
    int x = 73;
    int y = 48;
    _disp_show_flash_img(DISP_LFS_FILE_INDEX_0, x, y, FILE_IMG_J104_alarm_clock_icon);

    x = 88;
    y = 162;
    x = disp_draw_user_image_num_with_digits(x, y, disp_ctrl.com_data.i_temp[0], 2, 16, num_N300_dig_14x32_TAB);
    x += 2;
    disp_draw_user_image(x, y, num_N312_second_6x32);
    x += 8;
    x = disp_draw_user_image_num_with_digits(x, y, disp_ctrl.com_data.i_temp[1], 2, 16, num_N300_dig_14x32_TAB);
}
bool view_prompt_display(int view)
{
    switch (view)
    {
    case view_prompt_message:
        view_prompt_message_display();
        return true;
    case view_prompt_not_connect:
        view_prompt_not_connect_display();
        return true;
    case view_prompt_distance_complete:
        view_prompt_distance_complete_display();
        return true;
    case view_prompt_calories_complete:
        view_prompt_calories_complete_display();
        return true;
    case view_prompt_steps_complete:
        view_prompt_steps_complete_display();
        return true;
    case view_prompt_lost:
        view_prompt_lost_display();
        return true;
    case view_prompt_drink:
        view_prompt_drink_display();
        return true;
    case view_prompt_alarm:
        view_prompt_alarm_display();
        return true;
    case view_prompt_sedentariness:
        view_prompt_sedentariness_display();
        return true;
    case view_prompt_low_power:
        view_prompt_low_power_display();
        return true;
    case view_prompt_charing:
        view_prompt_charing_display();
        return true;
    case view_prompt_finding:
        view_prompt_find_wrist_display();
        return true;
    case view_prompt_not_wear:
        view_prompt_not_wear_display();
        return true;
    case view_prompt_bind_success:
        view_prompt_bind_success_display();
        return true;
    case view_prompt_camera_ready:
        view_prompt_camera_ready_display();
        return true;
    case view_prompt_camera_fail:
        view_prompt_camera_fail_display();
        return true;
    case view_prompt_music_not_connect:
        view_prompt_music_not_connect_display();
        return true;
    }
    return false;
}
bool view_power_off_charing_event(event_param_t param)
{
    if (!battery_ctrl_if_charging())
    {
        return false;
    }
    switch (param.event)
    {
    case BUTTON_EVENT_SHORT_PRESS:
        if (disp_ctrl.auto_close_delay < DISP_CLOSE_TIME_DEFAULT)
        {
            LOG("close delay restore by key");
            disp_ctrl.auto_close_delay = DISP_CLOSE_TIME_DEFAULT;
        }
        display_show(view_prompt_charing, DISP_MODE_NORMAL);
        break;
    }
    return false;
}
bool view_prompt_alarm_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_exit:
        motor_stop();
        return true;
    }
    return false;
}
bool view_prompt_music_not_connect_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Not_connected, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_camera_fail_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Please_open_the_READsport, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_low_power_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Low_battery, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_distance_complete_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Target_completion, buff, buff_len);
        return true;
    }
    }
    return false;
}

bool view_prompt_calories_complete_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Target_completion, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_steps_complete_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Target_completion, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_bind_success_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Connected, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_drink_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_drink_water, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_not_connect_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Not_Connected, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_lost_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Not_Connected, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_sedentariness_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Stand_up_and_exercise, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_not_wear_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_entry:
    {
        uint8_t *buff = &disp_ctrl.com_data.uint8_temp[101];
        uint32_t buff_len = disp_ctrl.com_data.uint8_temp + sizeof(disp_ctrl.com_data.uint8_temp) - buff;
        disp_ctrl.com_data.uint8_temp[100] = get_language_text(language_text_index_Not_wearing_a_watch, buff, buff_len);
        return true;
    }
    }
    return false;
}
bool view_prompt_find_wrist_event(int32_t view, event_param_t param)
{
    switch (param.event)
    {
    case event_view_exit:
    {
        motor_stop();
        return true;
    }
    }
    return false;
}

bool view_prompt_event(int view, event_param_t param)
{
    if (view < view_prompt_start || view >= view_prompt_end)
    {
        return false;
    }
    bool result = false;
    switch (view)
    {
    case view_prompt_message:
        result = view_prompt_message_event(view, param);
        break;
    case view_prompt_alarm:
        result = view_prompt_alarm_event(view, param);
        break;
    case view_prompt_music_not_connect:
        result = view_prompt_music_not_connect_event(view, param);
        break;
    case view_prompt_camera_fail:
        result = view_prompt_camera_fail_event(view, param);
        break;
    case view_prompt_low_power:
        result = view_prompt_low_power_event(view, param);
        break;
    case view_prompt_distance_complete:
        result = view_prompt_distance_complete_event(view, param);
        break;
    case view_prompt_calories_complete:
        result = view_prompt_calories_complete_event(view, param);
        break;
    case view_prompt_steps_complete:
        result = view_prompt_steps_complete_event(view, param);
        break;
    case view_prompt_bind_success:
        result = view_prompt_bind_success_event(view, param);
        break;
    case view_prompt_drink:
        result = view_prompt_drink_event(view, param);
        break;
    case view_prompt_not_connect:
        result = view_prompt_not_connect_event(view, param);
        break;
    case view_prompt_lost:
        result = view_prompt_lost_event(view, param);
        break;
    case view_prompt_sedentariness:
        result = view_prompt_sedentariness_event(view, param);
        break;
    case view_prompt_not_wear:
        result = view_prompt_not_wear_event(view, param);
        break;
    case view_prompt_finding:
        result = view_prompt_find_wrist_event(view, param);
        break;
    }
    if (result)
    {
        return true;
    }
    switch (param.event)
    {
    case event_move_level_up:
        display_show_type_recover();
        return true;
    }
    return false;
}
